package demo1;

import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-06-30
 * Time: 23:52
 */
public class Test {

    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();//栈的定义
        stack.push(1);//栈的插入
        stack.push(2);
        stack.push(3);
        stack.push(4);
        System.out.println(stack.pop());//栈的弹出
        System.out.println(stack.peek());//显示栈顶元素，不弹出
        System.out.println(stack.size());//栈的容量大小(栈中有几个元素)
        System.out.println(stack.empty());//判断栈是否为空
    }


}
